﻿using System;

namespace WebCommon
{
    /// <summary>
    /// 日志类
    /// </summary>
    public class Log
    {
        /// <summary>
        /// 输出日志到Log4Net
        /// </summary>
        /// <param name="t"></param>
        /// <param name="ex"></param>
        #region static void WriteLog(Type t, Exception ex)

        public static void WriteLog<T>(  Exception ex)
        {
            var log = log4net.LogManager.GetLogger(typeof(T));
            log.Error("Error", ex);
        }

        #endregion

        /// <summary>
        /// 输出日志到Log4Net
        /// </summary>
        /// <param name="t"></param>
        /// <param name="msg"></param>
        #region static void WriteLog(Type t, string msg)

        public static void WriteLog<T>( string msg)
        {
            var log = log4net.LogManager.GetLogger(typeof(T));
            log.Error(msg);
        }

        #endregion
    }
}